import React, { Component, Fragment } from 'react';
import PropTypes from 'prop-types';
import styles from './Result.less';
import CountUp from 'react-countup';

class Result extends Component {
  render() {
    const {
      result,
    } = this.props;

    return (
      <Fragment>
        <div className={styles.container}>
          <span className={styles.yuan}>￥</span>
          <CountUp start={0} end={result} className={styles.countup} decimals={2}/>
        </div>
      </Fragment>
    );
  }
}

Result.propTypes = {
  result: PropTypes.number.isRequired
};

export default Result;
